<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>

	<body>
		<h5>账号设置</h5>
		<input type="text" id="account" onchange="account()"><br />
		<h5>公司单位全称:</h5>
		  <input type="text" id="company" onchange="company()"><br /> 
		 <h5>用户名设置：</h5>
		  <input type="text" id="username" onchange="username()" /><br/> 
		 <h5>公司地址：</h5>
		  <input type="text" id="address" onchange="address()" /><br/> 
		 <h5>设置密码：</h5>
		  <input type="password" name="newpass" id="newpass" onchange="password()" /><br/> 
		 <h5>确认密码：</h5>
		  <input type="password" name="againpass" id="againpass" onchange="validate()" /><br/> 
		 <h5>职位：</h5>
		  <input type="text" id="position" onchange="position()" /><br/> 
		 <h5>月薪：</h5>
		  <input type="text" id="salary" onchange="salary()" /><br/> 
		 <h5>证件类型：</h5>
		  <input type="text" id="type" onchange="type()" /><br/>
		 <h5>证件号码：</h5>
		   <input type="text" id="number" onchange="number()" /><br/> 
		  <h5>性别： </h5>
		  <input type="radio" name="sex" id="sex" />男
		<input type="radio" name="sex" id="sex" />女<br/> 
		<h5>年龄 ：</h5>
		<input type="text" id="age" onchange="age()" /><br/>
		<h5>电子邮箱：</h5>
		  <input type="text" id="email" onchange="email()" /><br/> 
		 <h5>国家/地区：</h5>
		  <input type="text" id="city" onchange="city()" /> <br/>
		 <h5> 联系方式：</h5>
		  <input type="text" id="contact" onchange="contact()" /><br/> 
		  <h5> 验证码：</h5>
		  <input type="text" id="identify" onchange="identify()" /><br/>

		<button id="registerbtn">注册</button>
	</body>
	<script type="text/javascript">
		function validate() {
			var word1 = document.getElementById("newpass").value;
			var word2 = document.getElementById("againpass").value;
			if(word1 != word2) {
				window.alert("两次输入的新密码不一致！");
				againpass.focus();
				return false;
			}
			return true;
		}

		function account() {
			var account = document.getElementById('account');
			if(account.value == "") {
				alert("您输入的账号不能为空！");
			} else {
				account.onblur = function() {
					if(isNaN(Number(account.value))) {
						alert('账号不是数字！');
					}
				}
			}
		}

		function company() {
			var company = document.getElementById('company');
			if(company.value == "") {
				alert("您输入的公司单位全称不能为空！");
			} else {
				company.onblur = function() {
					if(isNaN(Number(company.value))) {

					} else {
						alert('您输入的公司单位全称不能是数字！');
					}
				}
			}
		}

		function username() {
			var username = document.getElementById('username');
			if(username.value == "") {
				alert("您输入的用户名设置不能为空！");
			}
		}

		function address() {
			var address = document.getElementById('address');
			if(address.value == "") {
				alert("您输入的公司地址不能为空！");
			} else {
				address.onblur = function() {
					if(isNaN(Number(address.value))) {

					} else {
						alert('您输入的公司地址不能是数字！');
					}
				}
			}
		}

		function password() {
			var password = document.getElementById('password');
			if(password.value == "") {
				alert("您设置的密码不能为空！");
			}
		}

		function checkpassword() {
			var checkpassword = document.getElementById('checkpassword');
			if(checkpassword.value == "") {
				alert("您再次输入的密码不能为空！");
			}
		}

		function position() {
			var position = document.getElementById('position');
			if(position.value == "") {
				alert("您输入的职位不能为空！");
			} else {
				position.onblur = function() {
					if(isNaN(Number(position.value))) {

					} else {
						alert('您输入的职位不能是数字！');
					}
				}
			}
		}

		function salary() {
			var salary = document.getElementById('salary');
			if(salary.value == "") {
				alert("您输入的月薪不能为空！");
			} else {
				salary.onblur = function() {
					if(isNaN(Number(salary.value))) {
						alert('月薪不是数字！');
					}
				}
			}
		}

		function type() {
			var type = document.getElementById('type');
			if(type.value == "") {
				alert("您的证件类型不能为空！");
			}
		}

		function number() {
			var number = document.getElementById('number');
			var str = /^\d{15}|\d{}18$/;
			if(number.value == "") {
				alert("您的证件号码不能为空！");
			} else {
				if(str.test(number.value)) {

				} else {
					alert("您输入的证件号码不正确！");
				}
			}

		}

		function age() {
			var age = document.getElementById('age');
			if(age.value == "") {
				alert("您的年龄不能为空！");
			} else {
				age.onblur = function() {
					if(isNaN(Number(age.value))) {
						alert('年龄不是数字！');
					}
				}
			}
		}

		function email() {
			var email = document.getElementById('email');
			var str1 = /^\w+@[a-zA-Z0-9]{2,10}(?:\.[a-z]{2,4}){1,3}$/;
			if(email.value == "") {
				alert("您输入的邮箱不能为空！");
			} else {
				if(str1.test(email.value)) {

				} else {
					alert("您输入的邮箱格式不正确！");
				}
			}
		}

		function city() {
			var city = document.getElementById('city');
			if(city.value == "") {
				alert("您输入的国家不能为空！");
			} else {
				city.onblur = function() {
					if(isNaN(Number(city.value))) {

					} else {
						alert('您输入的国家不能是数字！');
					}
				}
			}
		}

		function contact() {
			var contact = document.getElementById('contact');
			var str1 = /^((0\d{2,3}-\d{7,8})|(1[3584]\d{9}))$/;
			if(contact.value == "") {
				alert("您输入的联系方式不能为空！");
			} else {
				if(str1.test(contact.value)) {

				} else {
					alert("您输入的联系方式格式不正确！");
				}
			}
		}

		function identify() {
			var identify = document.getElementById('identify');
			if(identify.value == "") {
				alert("您输入的验证码不能为空！");
			}
		}
	</script>

</html>